home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Common / GameMenu.script < prev    next >
Text File  |  2002-01-09  |  29KB  |  1,446 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. //
  11. //  Game Menu
  12. //
  13.  
  14.  
  15. class CGameMenu extends CBaseMenu
  16. {
  17.   // methods
  18.  
  19.   void CGameMenu()
  20.   {
  21.   }
  22.  
  23.   string GetMenuType()
  24.   {
  25.     return "GameMenu";
  26.   }
  27.  
  28.   //
  29.   //  Menu construction happens here
  30.   //
  31.  
  32.   void InitMenu()
  33.   {
  34.     //
  35.     //  Background
  36.     //
  37.  
  38.     CreateBitmapControl(
  39.       "Resources/Splash.tex",
  40.       "ID_BITMAP",
  41.       0.0,
  42.       0.0,
  43.       1.0,
  44.       1.0
  45.     );
  46.  
  47.     // current build sign
  48.  
  49.     string CurrentBuild   = str_VersionNumber;
  50.     float  fMessageWidth  = GetTextWidth(CurrentBuild);
  51.     float  fMessageHeight = GetTextHeight(CurrentBuild);
  52.  
  53.     CreateTextControl(
  54.       CurrentBuild,
  55.       "ID_CURRENT_BUILD",
  56.       (1.0 - fMessageWidth) / 2,
  57.       0.05,
  58.       fMessageWidth,
  59.       fMessageHeight,
  60.       color(0.7, 0.7, 0.7)
  61.     );
  62.  
  63.     // menu
  64.  
  65.     CreateMenuButtonGroup(MenuWidth, MenuSpacing);
  66.  
  67.     float fButtonX      = 0.1375;
  68.     float fButtonY      = 0.66;
  69.     float fButtonWidth  = 0.35;
  70.  
  71.     //
  72.     //  Start new game button
  73.     //
  74.  
  75.     CreateBitmapSubMenu(
  76.       "ID_START_GAME",
  77.       nStartButtonNormMat,
  78.       nStartButtonHiMat,
  79.       0.253,
  80.       0.914,
  81.       fStdButtonWidth,
  82.       fStdButtonHeight,
  83.       true,
  84.       "GameMenu_InitMissionsMenu"
  85.     );
  86.  
  87.     //
  88.     //  Settings button
  89.     //
  90.  
  91.     CreateBitmapSubMenu(
  92.       "ID_SETTINGS",
  93.       nSettingsButtonNormMat,
  94.       nSettingsButtonHiMat,
  95.       0.378,
  96.       0.914,
  97.       fStdButtonWidth,
  98.       fStdButtonHeight,
  99.       true,
  100.       "BaseMenu_InitSettingsMenu"
  101.     );
  102.  
  103.     //
  104.     //  Credits button
  105.     //
  106.  
  107.     CreateBitmapSubMenu(
  108.       "ID_CREDITS",
  109.       nCreditsButtonNormMat,
  110.       nCreditsButtonHiMat,
  111.       0.503,
  112.       0.914,
  113.       fStdButtonWidth,
  114.       fStdButtonHeight,
  115.       true,
  116.       "ShowCredits"
  117.     );
  118.  
  119.     //
  120.     //  Quit button
  121.     //
  122.  
  123.     CreateBitmapSubMenu(
  124.       "ID_QUIT_MENU",
  125.       nQuitButtonNormMat,
  126.       nQuitButtonHiMat,
  127.       0.628,
  128.       0.914,
  129.       fStdButtonWidth,
  130.       fStdButtonHeight,
  131.       true,
  132.       "GameMenu_InitQuitMenu"
  133.     );
  134.   }
  135.  
  136.   //
  137.   //  Called on user move of menu button
  138.   //
  139.  
  140.   void MenuButtonMoved(string _id)
  141.   {
  142.     BaseMenu_MenuButtonMoved(_id);
  143.   }
  144.  
  145.   //
  146.   //  Called on user click on menu button
  147.   //
  148.  
  149.   void MenuButtonClicked(string _id)
  150.   {
  151.     BaseMenu_MenuButtonClicked(_id);
  152.  
  153.     //
  154.     //  All briefings ids
  155.     //
  156.  
  157.     if ("ID_PAGEUP" == _id)
  158.       SendCommandToControl("ID_MISSION_DESCRIPTION", "PageUp");
  159.     else
  160.     if ("ID_PAGEDN" == _id)
  161.       SendCommandToControl("ID_MISSION_DESCRIPTION", "PageDown");
  162.     else
  163.  
  164.  
  165.     if ("ID_QUIT" == _id)
  166.     {
  167.       Core_SendEventTo(SOID_GameController, "OnQuitGame");
  168.     }
  169.     else
  170.     if ("ID_RESTART_MISSION" == _id)
  171.     {
  172.       Core_SendEventTo(
  173.         SOID_GameController,
  174.         "OnRestartMission");
  175.     }
  176.     else
  177.     if ("ID_START_MISSION_1" == _id)
  178.     {
  179.       // go to the loading screen
  180.       GoToSubMenu("GameMenu_LoadScreen");
  181.  
  182.       // load mission
  183.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CDestroyMission", 0);
  184.     }
  185.     else
  186.     if ("ID_START_MISSION_2" == _id)
  187.     {
  188.       // go to the loading screen
  189.       GoToSubMenu("GameMenu_LoadScreen");
  190.  
  191.       // load mission
  192.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CConvoyMission", 1);
  193.     }
  194.     else
  195.     if ("ID_START_MISSION_3" == _id)
  196.     {
  197.       // go to the loading screen
  198.       GoToSubMenu("GameMenu_LoadScreen");
  199.  
  200.       // load mission
  201.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CFireworksMission", 2);
  202.     }
  203.     else
  204.     if ("ID_START_MISSION_4" == _id)
  205.     {
  206.       // go to the loading screen
  207.       GoToSubMenu("GameMenu_LoadScreen");
  208.  
  209.       // load mission
  210.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CDestroyGuardedTarget", 3);
  211.     }
  212.     else
  213.     if ("ID_START_MISSION_5" == _id)
  214.     {
  215.       // go to the loading screen
  216.       GoToSubMenu("GameMenu_LoadScreen");
  217.  
  218.       // load mission
  219.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CClearVillageMission", 4);
  220.     }
  221.     else
  222.     if ("ID_START_MISSION_6" == _id)
  223.     {
  224.       // go to the loading screen
  225.       GoToSubMenu("GameMenu_LoadScreen");
  226.  
  227.       // load mission
  228.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CPreventVillageDestructionMission", 5);
  229.     }
  230.     else
  231.     if ("ID_START_MISSION_7" == _id)
  232.     {
  233.       // go to the loading screen
  234.       GoToSubMenu("GameMenu_LoadScreen");
  235.  
  236.       // load mission
  237.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CBreakRingAndConvoyMission", 6);
  238.     }
  239.     else
  240.     if ("ID_START_MISSION_8" == _id)
  241.     {
  242.       // go to the loading screen
  243.       GoToSubMenu("GameMenu_LoadScreen");
  244.  
  245.       // load mission
  246.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CInterceptJeepMission", 7);
  247.     }
  248.     else
  249.     if ("ID_START_MISSION_9" == _id)
  250.     {
  251.       // go to the loading screen
  252.       GoToSubMenu("GameMenu_LoadScreen");
  253.  
  254.       // load mission
  255.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CTankBattleMission", 8);
  256.     }
  257.     else
  258.     if ("ID_START_MISSION_10" == _id)
  259.     {
  260.       // go to the loading screen
  261.       GoToSubMenu("GameMenu_LoadScreen");
  262.  
  263.       // load mission
  264.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CInterceptConvoyMission", 9);
  265.     }
  266.     else
  267.     if ("ID_START_MISSION_11" == _id)
  268.     {
  269.       // go to the loading screen
  270.       GoToSubMenu("GameMenu_LoadScreen");
  271.  
  272.       // load mission
  273.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CDrawAttentionMission", 10);
  274.     }
  275.     else
  276.     if ("ID_START_MISSION_12" == _id)
  277.     {
  278.       // go to the loading screen
  279.       GoToSubMenu("GameMenu_LoadScreen");
  280.  
  281.       // load mission
  282.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CEliminatePartisansMission", 11);
  283.     }
  284.     else
  285.     if ("ID_START_MISSION_13" == _id)
  286.     {
  287.       // go to the loading screen
  288.       GoToSubMenu("GameMenu_LoadScreen");
  289.  
  290.       // load mission
  291.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CSupportAerialAttackMission", 12);
  292.     }
  293.     else
  294.     if ("ID_START_MISSION_14" == _id)
  295.     {
  296.       // go to the loading screen
  297.       GoToSubMenu("GameMenu_LoadScreen");
  298.  
  299.       // load mission
  300.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CEliminateDescentMission", 13);
  301.     }
  302.     else
  303.     if ("ID_START_MISSION_15" == _id)
  304.     {
  305.       // go to the loading screen
  306.       GoToSubMenu("GameMenu_LoadScreen");
  307.  
  308.       // load mission
  309.       Core_SendEventTo(SOID_GameController, "OnLoadMission", "CSurvivalMission", 14);
  310.     }
  311.     else
  312.     if ("ID_CREDITS_SCREEN" == _id)
  313.     {
  314.       m_nCreditsScreenNumber = (m_nCreditsScreenNumber + 1) % str_CreditsScreens.size();
  315.       if (0 == m_nCreditsScreenNumber)
  316.         GoToRootMenu();
  317.       else
  318.         GoToSubMenu("ShowCredits");
  319.     }
  320.   }
  321.  
  322.   //
  323.   //  Submenus construction
  324.   //
  325.  
  326.   //
  327.   //  Quit confirmation screen
  328.   //
  329.  
  330.   void GameMenu_InitQuitMenu()
  331.   {
  332.     //
  333.     //  Background
  334.     //
  335.  
  336.     CreateBitmapControl(
  337.       "Resources/Splash.tex",
  338.       "ID_BITMAP",
  339.       0.0,
  340.       0.0,
  341.       1.0,
  342.       1.0
  343.     );
  344.  
  345.     //
  346.     //  Text control with objectives
  347.     //
  348.  
  349.     float fMessageWidth  = GetTextWidth(str_QuitGameQuestion);
  350.     float fMessageHeight = GetTextHeight(str_QuitGameQuestion);
  351.     float fBasePosition  = 0.7f;
  352.  
  353.     CreateTextControl(
  354.       str_QuitGameQuestion,
  355.       "ID_QUESTION",
  356.       (1.0 - fMessageWidth) / 2,
  357.       fBasePosition,
  358.       fMessageWidth,
  359.       fMessageHeight
  360.     );
  361.  
  362.     CreateMenuButtonGroup(MenuWidth, MenuSpacing);
  363.  
  364.     float fButtonX      = (1.0 - fButtonWidth) / 2;
  365.     float fButtonY      = fBasePosition + fMessageHeight + fVertSpacing;
  366.  
  367.     //
  368.     //  Back button
  369.     //
  370.  
  371.     CreateTextButton(
  372.       str_NoButton,
  373.       "ID_BACK",
  374.       fButtonX,
  375.       fButtonY,
  376.       fButtonWidth,
  377.       fButtonHeight);
  378.  
  379.     fButtonY = fButtonY + fButtonHeight + fVertSpacing;
  380.  
  381.     //
  382.     //  Test mission button
  383.     //
  384.  
  385.     CreateTextButton(
  386.       str_YesButton,
  387.       "ID_QUIT",
  388.       fButtonX,
  389.       fButtonY,
  390.       fButtonWidth,
  391.       fButtonHeight);
  392.  
  393.     fButtonY = fButtonY + fButtonHeight + fVertSpacing;
  394.   }
  395.  
  396.  
  397.   //
  398.   //  Loading screen
  399.   //
  400.  
  401.   void GameMenu_LoadScreen()
  402.   {
  403.     //
  404.     //  Background
  405.     //
  406.  
  407.     CreateBitmapControl(
  408.       "Resources/Menu_Mission_Loading.tex",
  409.       "ID_BITMAP",
  410.       0.0,
  411.       0.0,
  412.       1.0,
  413.       1.0
  414.     );
  415.  
  416.     float fProgressWidth  = 0.39;
  417.     float fProgressHeight = fButtonHeight;
  418.  
  419.     float fProgressX = (1.0 - fProgressWidth) / 2;
  420.     float fProgressY = 0.9;
  421.  
  422.     CreateProgressBar(
  423.       "ID_LOAD_PROGRESS_BAR",
  424.       color(1.0, 1.0, 1.0),
  425.       fProgressX,
  426.       fProgressY,
  427.       fProgressWidth,
  428.       fProgressHeight);
  429.   }
  430.  
  431.   //
  432.   //  Missions menu
  433.   //
  434.  
  435.   // array of mission button positions on screen
  436.  
  437.   array m_MissionButtonX =
  438.     array(
  439.       402.0, 610.0, 177.0, 417.0, 67.0, 738.0, 387.0, 738.0, 417.0, 738.0, 67.0, 387.0, 387.0, 67.0, 417.0
  440.     );
  441.  
  442.   array m_MissionButtonY =
  443.     array(
  444.       353.0, 290.0, 417.0, 226.0, 482.0, 226.0, 482.0, 160.0, 160.0, 97.0, 546.0, 546.0, 610.0, 610.0, 97.0
  445.     );
  446.  
  447.   float GetMissionButtonX(int i)
  448.   {
  449.     return (m_MissionButtonX[i] - 10.0) / 1024.0;
  450.   }
  451.  
  452.   float GetMissionButtonY(int i)
  453.   {
  454.     return (m_MissionButtonY[i] - 3.0) / 768.0;
  455.   }
  456.  
  457.   void DrawMedal(int _mission)
  458.   {
  459.     int state = Core_CallFunction(
  460.                  SOID_GameController,
  461.                  "GetMissionState",
  462.                  _mission
  463.                );
  464.  
  465.     if (state == 0 || state == 1)
  466.       return;
  467.  
  468.     int material = 4 + (state - 2);
  469.  
  470.     CreateMaterialControl(
  471.       "Common/Medals.skin",
  472.       material,
  473.       "ID_MEDAL" + _mission,
  474.       GetMissionButtonX(_mission) - 0.023,
  475.       GetMissionButtonY(_mission) + 0.005,
  476.       0.027,
  477.       0.035
  478.     );
  479.   }
  480.  
  481.   void DrawOrders()
  482.   {
  483.  
  484.     float MedalWidth  = 0.07;
  485.     float MedalHeight = 0.15;
  486.  
  487.     bool  bHeliMedal  = true;
  488.     bool  bBronzeStar = true;
  489.     bool  bSilverStar = true;
  490.     bool  bGoldStar   = true;
  491.  
  492.     for (int i = 0; i < 15; i = i + 1)
  493.     {
  494.       int state = Core_CallFunction(
  495.                     SOID_GameController,
  496.                     "GetMissionState",
  497.                     i
  498.                   );
  499.  
  500.       if (state < 2)
  501.       {
  502.         bHeliMedal  = false;
  503.         bBronzeStar = false;
  504.         bSilverStar = false;
  505.         bGoldStar   = false;
  506.       }
  507.  
  508.       if (state < 3)
  509.       {
  510.         bBronzeStar = false;
  511.         bSilverStar = false;
  512.         bGoldStar   = false;
  513.       }
  514.  
  515.       if (state < 4)
  516.       {
  517.         bSilverStar = false;
  518.         bGoldStar   = false;
  519.       }
  520.  
  521.       if (state < 5)
  522.       {
  523.         bGoldStar   = false;
  524.       }
  525.     }
  526.  
  527.     if (!bHeliMedal)
  528.       return;
  529.  
  530.     CreateMaterialControl(
  531.       "Common/Medals.skin",
  532.       0,
  533.       "ID_BIG_MEDAL_0",
  534.       0.043,
  535.       0.127,
  536.       MedalWidth,
  537.       MedalHeight
  538.     );
  539.  
  540.     float MedalsX    = 0.043 + 0.079;
  541.     float MedalsY    = 0.127;
  542.     float MedalsDist = 0.073;
  543.  
  544.     if (!bBronzeStar)
  545.       return;
  546.  
  547.     CreateMaterialControl(
  548.       "Common/Medals.skin",
  549.       1,
  550.       "ID_BIG_MEDAL_1",
  551.       MedalsX,
  552.       MedalsY,
  553.       MedalWidth,
  554.       MedalHeight
  555.     );
  556.  
  557.     MedalsX = MedalsX + MedalsDist;
  558.  
  559.     if (!bSilverStar)
  560.       return;
  561.  
  562.     CreateMaterialControl(
  563.       "Common/Medals.skin",
  564.       2,
  565.       "ID_BIG_MEDAL_2",
  566.       MedalsX,
  567.       MedalsY,
  568.       MedalWidth,
  569.       MedalHeight
  570.     );
  571.  
  572.     MedalsX = MedalsX + MedalsDist;
  573.  
  574.     if (!bGoldStar)
  575.       return;
  576.  
  577.     CreateMaterialControl(
  578.       "Common/Medals.skin",
  579.       3,
  580.       "ID_BIG_MEDAL_3",
  581.       MedalsX,
  582.       MedalsY,
  583.       MedalWidth,
  584.       MedalHeight
  585.     );
  586.   }
  587.  
  588.   void GameMenu_InitMissionsMenu()
  589.   {
  590.     //
  591.     //  Background
  592.     //
  593.  
  594.     CreateBitmapControl(
  595.       "Resources/SelectMission.tex",
  596.       "ID_BITMAP",
  597.       0.0,
  598.       0.0,
  599.       1.0,
  600.       1.0
  601.     );
  602.  
  603.     string CurrentDifficulty;
  604.     int diff_level = GetDifficultyLevel();
  605.     if (diff_level == 0)
  606.       CurrentDifficulty = str_Difficulty + str_Easy;
  607.     else
  608.     if (diff_level == 1)
  609.       CurrentDifficulty = str_Difficulty + str_Medium;
  610.     else
  611.     if (diff_level == 2)
  612.       CurrentDifficulty = str_Difficulty + str_Hard;
  613.     else
  614.     if (diff_level == 3)
  615.       CurrentDifficulty = str_Difficulty + str_Nightmare;
  616.  
  617.     float  fMessageWidth  = GetTextWidth(CurrentDifficulty);
  618.     float  fMessageHeight = GetTextHeight(CurrentDifficulty);
  619.  
  620.     CreateTextControl(
  621.       CurrentDifficulty,
  622.       "ID_CURRENT_DIFFICULTY",
  623.       0.05,
  624.       0.3,
  625.       fMessageWidth,
  626.       fMessageHeight,
  627.       color(0.89, 0.5, 0.41)
  628.     );
  629.  
  630.     CreateMenuButtonGroup(MenuWidth, MenuSpacing);
  631.  
  632.     bool  bEnabled;
  633.  
  634.     float fMissionButtonWidth  = 0.25;
  635.     float fMissionButtonHeight = 0.03125 / 0.75;
  636.  
  637.     DrawOrders();
  638.  
  639.     //
  640.     //  Mission 1 button
  641.     //
  642.  
  643.     int nMissMat = 16;
  644.  
  645.     bEnabled = Core_CallFunction(
  646.                  SOID_GameController,
  647.                  "GetMissionState",
  648.                  0
  649.                );
  650.  
  651.     CreateBitmapSubMenu(
  652.       "ID_MISSION_1",
  653.       nMissMat,
  654.       nMissMat + 1,
  655.       GetMissionButtonX(0),
  656.       GetMissionButtonY(0),
  657.       fMissionButtonWidth,
  658.       fMissionButtonHeight,
  659.       bEnabled,
  660.       "GameMenu_InitMission1Briefing"
  661.     );
  662.  
  663.     DrawMedal(0);
  664.  
  665.     nMissMat = nMissMat + 2;
  666.  
  667.     //
  668.     //  Mission 2 button
  669.     //
  670.  
  671.     bEnabled = Core_CallFunction(
  672.                  SOID_GameController,
  673.                  "GetMissionState",
  674.                  1
  675.                );
  676.  
  677.     CreateBitmapSubMenu(
  678.       "ID_MISSION_2",
  679.       nMissMat,
  680.       nMissMat + 1,
  681.       GetMissionButtonX(1),
  682.       GetMissionButtonY(1),
  683.       fMissionButtonWidth,
  684.       fMissionButtonHeight,
  685.       bEnabled,
  686.       "GameMenu_InitMission2Briefing"
  687.     );
  688.  
  689.     DrawMedal(1);
  690.  
  691.     nMissMat = nMissMat + 2;
  692.  
  693.     //
  694.     //  Mission 3 button
  695.     //
  696.  
  697.     bEnabled = Core_CallFunction(
  698.                  SOID_GameController,
  699.                  "GetMissionState",
  700.                  2
  701.                );
  702.  
  703.     CreateBitmapSubMenu(
  704.       "ID_MISSION_3",
  705.       nMissMat,
  706.       nMissMat + 1,
  707.       GetMissionButtonX(2),
  708.       GetMissionButtonY(2),
  709.       fMissionButtonWidth,
  710.       fMissionButtonHeight,
  711.       bEnabled,
  712.       "GameMenu_InitMission3Briefing"
  713.     );
  714.  
  715.     DrawMedal(2);
  716.  
  717.     nMissMat = nMissMat + 2;
  718.  
  719.     //
  720.     //  Mission 4 button
  721.     //
  722.  
  723.     bEnabled = Core_CallFunction(
  724.                  SOID_GameController,
  725.                  "GetMissionState",
  726.                  3
  727.                );
  728.  
  729.     CreateBitmapSubMenu(
  730.       "ID_MISSION_4",
  731.       nMissMat,
  732.       nMissMat + 1,
  733.       GetMissionButtonX(3),
  734.       GetMissionButtonY(3),
  735.       fMissionButtonWidth,
  736.       fMissionButtonHeight,
  737.       bEnabled,
  738.       "GameMenu_InitMission4Briefing"
  739.     );
  740.  
  741.     DrawMedal(3);
  742.  
  743.     nMissMat = nMissMat + 2;
  744.  
  745.     //
  746.     //  Mission 5 button
  747.     //
  748.  
  749.     bEnabled = Core_CallFunction(
  750.                  SOID_GameController,
  751.                  "GetMissionState",
  752.                  4
  753.                );
  754.  
  755.     CreateBitmapSubMenu(
  756.       "ID_MISSION_5",
  757.       nMissMat,
  758.       nMissMat + 1,
  759.       GetMissionButtonX(4),
  760.       GetMissionButtonY(4),
  761.       fMissionButtonWidth,
  762.       fMissionButtonHeight,
  763.       bEnabled,
  764.       "GameMenu_InitMission5Briefing"
  765.     );
  766.  
  767.     DrawMedal(4);
  768.  
  769.     nMissMat = nMissMat + 2;
  770.  
  771.     //
  772.     //  Mission 6 button
  773.     //
  774.  
  775.     bEnabled = Core_CallFunction(
  776.                  SOID_GameController,
  777.                  "GetMissionState",
  778.                  5
  779.                );
  780.  
  781.     CreateBitmapSubMenu(
  782.       "ID_MISSION_6",
  783.       nMissMat,
  784.       nMissMat + 1,
  785.       GetMissionButtonX(5),
  786.       GetMissionButtonY(5),
  787.       fMissionButtonWidth,
  788.       fMissionButtonHeight,
  789.       bEnabled,
  790.       "GameMenu_InitMission6Briefing"
  791.     );
  792.  
  793.     DrawMedal(5);
  794.  
  795.     nMissMat = nMissMat + 2;
  796.  
  797.     //
  798.     //  Mission 7 button
  799.     //
  800.  
  801.     bEnabled = Core_CallFunction(
  802.                  SOID_GameController,
  803.                  "GetMissionState",
  804.                  6
  805.                );
  806.  
  807.     CreateBitmapSubMenu(
  808.       "ID_MISSION_7",
  809.       nMissMat,
  810.       nMissMat + 1,
  811.       GetMissionButtonX(6),
  812.       GetMissionButtonY(6),
  813.       fMissionButtonWidth,
  814.       fMissionButtonHeight,
  815.       bEnabled,
  816.       "GameMenu_InitMission7Briefing"
  817.     );
  818.  
  819.     DrawMedal(6);
  820.  
  821.     nMissMat = nMissMat + 2;
  822.  
  823.     //
  824.     //  Mission 8 button
  825.     //
  826.  
  827.     bEnabled = Core_CallFunction(
  828.                  SOID_GameController,
  829.                  "GetMissionState",
  830.                  7
  831.                );
  832.  
  833.     CreateBitmapSubMenu(
  834.       "ID_MISSION_8",
  835.       nMissMat,
  836.       nMissMat + 1,
  837.       GetMissionButtonX(7),
  838.       GetMissionButtonY(7),
  839.       fMissionButtonWidth,
  840.       fMissionButtonHeight,
  841.       bEnabled,
  842.       "GameMenu_InitMission8Briefing"
  843.     );
  844.  
  845.     DrawMedal(7);
  846.  
  847.     nMissMat = nMissMat + 2;
  848.  
  849.     //
  850.     //  Mission 9 button
  851.     //
  852.  
  853.     bEnabled = Core_CallFunction(
  854.                  SOID_GameController,
  855.                  "GetMissionState",
  856.                  8
  857.                );
  858.  
  859.     CreateBitmapSubMenu(
  860.       "ID_MISSION_9",
  861.       nMissMat,
  862.       nMissMat + 1,
  863.       GetMissionButtonX(8),
  864.       GetMissionButtonY(8),
  865.       fMissionButtonWidth,
  866.       fMissionButtonHeight,
  867.       bEnabled,
  868.       "GameMenu_InitMission9Briefing"
  869.     );
  870.  
  871.     DrawMedal(8);
  872.  
  873.     nMissMat = nMissMat + 2;
  874.  
  875.     //
  876.     //  Mission 10 button
  877.     //
  878.  
  879.     bEnabled = Core_CallFunction(
  880.                  SOID_GameController,
  881.                  "GetMissionState",
  882.                  9
  883.                );
  884.  
  885.     CreateBitmapSubMenu(
  886.       "ID_MISSION_10",
  887.       nMissMat,
  888.       nMissMat + 1,
  889.       GetMissionButtonX(9),
  890.       GetMissionButtonY(9),
  891.       fMissionButtonWidth,
  892.       fMissionButtonHeight,
  893.       bEnabled,
  894.       "GameMenu_InitMission10Briefing"
  895.     );
  896.  
  897.     DrawMedal(9);
  898.  
  899.     nMissMat = nMissMat + 2;
  900.  
  901.     //
  902.     //  Back button
  903.     //
  904.  
  905.     CreateBitmapButton(
  906.       "ID_BACK",
  907.       nBackButtonNormMat,
  908.       nBackButtonHiMat,
  909.       0.471,
  910.       0.914,
  911.       fStdButtonWidth,
  912.       fStdButtonHeight
  913.     );
  914.  
  915.     //
  916.     //  Mission 11 button
  917.     //
  918.  
  919.     bEnabled = Core_CallFunction(
  920.                  SOID_GameController,
  921.                  "GetMissionState",
  922.                  10
  923.                );
  924.  
  925.     CreateBitmapSubMenu(
  926.       "ID_MISSION_11",
  927.       nMissMat,
  928.       nMissMat + 1,
  929.       GetMissionButtonX(10),
  930.       GetMissionButtonY(10),
  931.       fMissionButtonWidth,
  932.       fMissionButtonHeight,
  933.       bEnabled,
  934.       "GameMenu_InitMission11Briefing"
  935.     );
  936.  
  937.     DrawMedal(10);
  938.  
  939.     nMissMat = nMissMat + 2;
  940.  
  941.     //
  942.     //  Mission 12 button
  943.     //
  944.  
  945.     bEnabled = Core_CallFunction(
  946.                  SOID_GameController,
  947.                  "GetMissionState",
  948.                  11
  949.                );
  950.  
  951.     CreateBitmapSubMenu(
  952.       "ID_MISSION_12",
  953.       nMissMat,
  954.       nMissMat + 1,
  955.       GetMissionButtonX(11),
  956.       GetMissionButtonY(11),
  957.       fMissionButtonWidth,
  958.       fMissionButtonHeight,
  959.       bEnabled,
  960.       "GameMenu_InitMission12Briefing"
  961.     );
  962.  
  963.     DrawMedal(11);
  964.  
  965.     nMissMat = nMissMat + 2;
  966.  
  967.     //
  968.     //  Mission 13 button
  969.     //
  970.  
  971.     bEnabled = Core_CallFunction(
  972.                  SOID_GameController,
  973.                  "GetMissionState",
  974.                  12
  975.                );
  976.  
  977.     CreateBitmapSubMenu(
  978.       "ID_MISSION_13",
  979.       nMissMat,
  980.       nMissMat + 1,
  981.       GetMissionButtonX(12),
  982.       GetMissionButtonY(12),
  983.       fMissionButtonWidth,
  984.       fMissionButtonHeight,
  985.       bEnabled,
  986.       "GameMenu_InitMission13Briefing"
  987.     );
  988.  
  989.     DrawMedal(12);
  990.  
  991.     nMissMat = nMissMat + 2;
  992.  
  993.     //
  994.     //  Mission 14 button
  995.     //
  996.  
  997.     bEnabled = Core_CallFunction(
  998.                  SOID_GameController,
  999.                  "GetMissionState",
  1000.                  13
  1001.                );
  1002.  
  1003.     CreateBitmapSubMenu(
  1004.       "ID_MISSION_14",
  1005.       nMissMat,
  1006.       nMissMat + 1,
  1007.       GetMissionButtonX(13),
  1008.       GetMissionButtonY(13),
  1009.       fMissionButtonWidth,
  1010.       fMissionButtonHeight,
  1011.       bEnabled,
  1012.       "GameMenu_InitMission14Briefing"
  1013.     );
  1014.  
  1015.     DrawMedal(13);
  1016.  
  1017.     nMissMat = nMissMat + 2;
  1018.  
  1019.     //
  1020.     //  Mission 15 button
  1021.     //
  1022.  
  1023.     bEnabled = Core_CallFunction(
  1024.                  SOID_GameController,
  1025.                  "GetMissionState",
  1026.                  14
  1027.                );
  1028.  
  1029.     CreateBitmapSubMenu(
  1030.       "ID_MISSION_15",
  1031.       nMissMat,
  1032.       nMissMat + 1,
  1033.       GetMissionButtonX(14),
  1034.       GetMissionButtonY(14),
  1035.       fMissionButtonWidth,
  1036.       fMissionButtonHeight,
  1037.       bEnabled,
  1038.       "GameMenu_InitMission15Briefing"
  1039.     );
  1040.  
  1041.     DrawMedal(14);
  1042.  
  1043.     nMissMat = nMissMat + 2;
  1044.   }
  1045.  
  1046.   //
  1047.   //  Briefings
  1048.   //
  1049.  
  1050.   //
  1051.   //  Mission 1
  1052.   //
  1053.  
  1054.   void GameMenu_InitMission1Briefing()
  1055.   {
  1056.     GameMenu_InitBriefing(
  1057.       "Resources/Mission1Briefing.tex",
  1058.       "Resources/Mission1Description.txt",
  1059.       "Resources/Mission1Objectives.txt",
  1060.       "Resources/Mission1BonusObjectives.txt",
  1061.       "ID_START_MISSION_1"
  1062.     );
  1063.   }
  1064.  
  1065.   //
  1066.   //  Mission 2
  1067.   //
  1068.  
  1069.   void GameMenu_InitMission2Briefing()
  1070.   {
  1071.     GameMenu_InitBriefing(
  1072.       "Resources/Mission2Briefing.tex",
  1073.       "Resources/Mission2Description.txt",
  1074.       "Resources/Mission2Objectives.txt",
  1075.       "Resources/Mission2BonusObjectives.txt",
  1076.       "ID_START_MISSION_2"
  1077.     );
  1078.   }
  1079.  
  1080.   //
  1081.   //  Mission 3
  1082.   //
  1083.  
  1084.   void GameMenu_InitMission3Briefing()
  1085.   {
  1086.     GameMenu_InitBriefing(
  1087.       "Resources/Mission3Briefing.tex",
  1088.       "Resources/Mission3Description.txt",
  1089.       "Resources/Mission3Objectives.txt",
  1090.       "Resources/Mission3BonusObjectives.txt",
  1091.       "ID_START_MISSION_3"
  1092.     );
  1093.   }
  1094.  
  1095.   //
  1096.   //  Mission 4
  1097.   //
  1098.  
  1099.   void GameMenu_InitMission4Briefing()
  1100.   {
  1101.     GameMenu_InitBriefing(
  1102.       "Resources/Mission4Briefing.tex",
  1103.       "Resources/Mission4Description.txt",
  1104.       "Resources/Mission4Objectives.txt",
  1105.       "Resources/Mission4BonusObjectives.txt",
  1106.       "ID_START_MISSION_4"
  1107.     );
  1108.   }
  1109.  
  1110.   //
  1111.   //  Mission 5
  1112.   //
  1113.  
  1114.   void GameMenu_InitMission5Briefing()
  1115.   {
  1116.     GameMenu_InitBriefing(
  1117.       "Resources/Mission5Briefing.tex",
  1118.       "Resources/Mission5Description.txt",
  1119.       "Resources/Mission5Objectives.txt",
  1120.       "Resources/Mission5BonusObjectives.txt",
  1121.       "ID_START_MISSION_5"
  1122.     );
  1123.   }
  1124.  
  1125.   //
  1126.   //  Mission 6
  1127.   //
  1128.  
  1129.   void GameMenu_InitMission6Briefing()
  1130.   {
  1131.     GameMenu_InitBriefing(
  1132.       "Resources/Mission6Briefing.tex",
  1133.       "Resources/Mission6Description.txt",
  1134.       "Resources/Mission6Objectives.txt",
  1135.       "Resources/Mission6BonusObjectives.txt",
  1136.       "ID_START_MISSION_6"
  1137.     );
  1138.   }
  1139.  
  1140.   //
  1141.   //  Mission 7
  1142.   //
  1143.  
  1144.   void GameMenu_InitMission7Briefing()
  1145.   {
  1146.     GameMenu_InitBriefing(
  1147.       "Resources/Mission7Briefing.tex",
  1148.       "Resources/Mission7Description.txt",
  1149.       "Resources/Mission7Objectives.txt",
  1150.       "Resources/Mission7BonusObjectives.txt",
  1151.       "ID_START_MISSION_7"
  1152.     );
  1153.   }
  1154.  
  1155.   //
  1156.   //  Mission 8
  1157.   //
  1158.  
  1159.   void GameMenu_InitMission8Briefing()
  1160.   {
  1161.     GameMenu_InitBriefing(
  1162.       "Resources/Mission8Briefing.tex",
  1163.       "Resources/Mission8Description.txt",
  1164.       "Resources/Mission8Objectives.txt",
  1165.       "Resources/Mission8BonusObjectives.txt",
  1166.       "ID_START_MISSION_8"
  1167.     );
  1168.   }
  1169.  
  1170.   //
  1171.   //  Mission 9
  1172.   //
  1173.  
  1174.   void GameMenu_InitMission9Briefing()
  1175.   {
  1176.     GameMenu_InitBriefing(
  1177.       "Resources/Mission9Briefing.tex",
  1178.       "Resources/Mission9Description.txt",
  1179.       "Resources/Mission9Objectives.txt",
  1180.       "Resources/Mission9BonusObjectives.txt",
  1181.       "ID_START_MISSION_9"
  1182.     );
  1183.   }
  1184.  
  1185.   //
  1186.   //  Mission 10
  1187.   //
  1188.  
  1189.   void GameMenu_InitMission10Briefing()
  1190.   {
  1191.     GameMenu_InitBriefing(
  1192.       "Resources/Mission10Briefing.tex",
  1193.       "Resources/Mission10Description.txt",
  1194.       "Resources/Mission10Objectives.txt",
  1195.       "Resources/Mission10BonusObjectives.txt",
  1196.       "ID_START_MISSION_10"
  1197.     );
  1198.   }
  1199.  
  1200.   //
  1201.   //  Mission 11
  1202.   //
  1203.  
  1204.   void GameMenu_InitMission11Briefing()
  1205.   {
  1206.     GameMenu_InitBriefing(
  1207.       "Resources/Mission11Briefing.tex",
  1208.       "Resources/Mission11Description.txt",
  1209.       "Resources/Mission11Objectives.txt",
  1210.       "Resources/Mission11BonusObjectives.txt",
  1211.       "ID_START_MISSION_11"
  1212.     );
  1213.   }
  1214.  
  1215.   //
  1216.   //  Mission 12
  1217.   //
  1218.  
  1219.   void GameMenu_InitMission12Briefing()
  1220.   {
  1221.     GameMenu_InitBriefing(
  1222.       "Resources/Mission12Briefing.tex",
  1223.       "Resources/Mission12Description.txt",
  1224.       "Resources/Mission12Objectives.txt",
  1225.       "Resources/Mission12BonusObjectives.txt",
  1226.       "ID_START_MISSION_12"
  1227.     );
  1228.   }
  1229.  
  1230.   //
  1231.   //  Mission 13
  1232.   //
  1233.  
  1234.   void GameMenu_InitMission13Briefing()
  1235.   {
  1236.     GameMenu_InitBriefing(
  1237.       "Resources/Mission13Briefing.tex",
  1238.       "Resources/Mission13Description.txt",
  1239.       "Resources/Mission13Objectives.txt",
  1240.       "Resources/Mission13BonusObjectives.txt",
  1241.       "ID_START_MISSION_13"
  1242.     );
  1243.   }
  1244.  
  1245.   //
  1246.   //  Mission 14
  1247.   //
  1248.  
  1249.   void GameMenu_InitMission14Briefing()
  1250.   {
  1251.     GameMenu_InitBriefing(
  1252.       "Resources/Mission14Briefing.tex",
  1253.       "Resources/Mission14Description.txt",
  1254.       "Resources/Mission14Objectives.txt",
  1255.       "Resources/Mission14BonusObjectives.txt",
  1256.       "ID_START_MISSION_14"
  1257.     );
  1258.   }
  1259.  
  1260.   //
  1261.   //  Mission 15
  1262.   //
  1263.  
  1264.   void GameMenu_InitMission15Briefing()
  1265.   {
  1266.     GameMenu_InitBriefing(
  1267.       "Resources/Mission15Briefing.tex",
  1268.       "Resources/Mission15Description.txt",
  1269.       "Resources/Mission15Objectives.txt",
  1270.       "Resources/Mission15BonusObjectives.txt",
  1271.       "ID_START_MISSION_15"
  1272.     );
  1273.   }
  1274.  
  1275.   void GameMenu_InitBriefing(
  1276.          string MapPictureFile,
  1277.          string DescriptionFile,
  1278.          string ObjectivesFile,
  1279.          string BonusObjectivesFile,
  1280.          string StartMissionButtonID
  1281.         )
  1282.   {
  1283.     //
  1284.     //  Background
  1285.     //
  1286.  
  1287.     CreateBitmapControl(
  1288.       "Resources/Menu_Briefing.tex",
  1289.       "ID_BITMAP",
  1290.       0.0,
  1291.       0.0,
  1292.       1.0,
  1293.       1.0
  1294.     );
  1295.  
  1296.     float fSpacing = 0.025;
  1297.  
  1298.     //
  1299.     //  Map
  1300.     //
  1301.  
  1302.     CreateBitmapControl(
  1303.       MapPictureFile,
  1304.       "ID_BITMAP",
  1305.       0.508,
  1306.       0.339,
  1307.       0.420,
  1308.       0.560
  1309.     );
  1310.  
  1311.     //
  1312.     //  Text control with mission description
  1313.     //
  1314.  
  1315.     color BriefingTextColor = color(0.835, 0.415, 0.313);
  1316.  
  1317.     CreateTextControl(
  1318.       LoadTextFromFile(DescriptionFile),
  1319.       "ID_MISSION_DESCRIPTION",
  1320.       0.095,
  1321.       0.165,
  1322.       0.830,
  1323.       0.140,
  1324.       BriefingTextColor
  1325.     );
  1326.  
  1327.     //
  1328.     //  Text control with primary objectives
  1329.     //
  1330.  
  1331.     CreateTextControl(
  1332.       LoadTextFromFile(ObjectivesFile),
  1333.       "ID_MISSION_OBJECTIVES",
  1334.       0.095,
  1335.       0.442,
  1336.       0.405,
  1337.       0.182,
  1338.       BriefingTextColor
  1339.     );
  1340.  
  1341.     //
  1342.     //  Text control with bonus objectives
  1343.     //
  1344.  
  1345.     CreateTextControl(
  1346.       LoadTextFromFile(BonusObjectivesFile),
  1347.       "ID_BONUS_MISSION_OBJECTIVES",
  1348.       0.095,
  1349.       0.684,
  1350.       0.405,
  1351.       0.200,
  1352.       BriefingTextColor
  1353.     );
  1354.  
  1355.     //
  1356.     //  Page Down button
  1357.     //
  1358.  
  1359.     CreateBitmapButton(
  1360.       "ID_PAGEDN",
  1361.       nDownButtonNormMat,
  1362.       nDownButtonHiMat,
  1363.       0.855,
  1364.       0.302,
  1365.       fScrollButtonWidth,
  1366.       fScrollButtonHeight
  1367.     );
  1368.  
  1369.     //
  1370.     //  Page Up button
  1371.     //
  1372.  
  1373.     CreateBitmapButton(
  1374.       "ID_PAGEUP",
  1375.       nUpButtonNormMat,
  1376.       nUpButtonHiMat,
  1377.       0.855 + fScrollButtonWidth,
  1378.       0.302,
  1379.       fScrollButtonWidth,
  1380.       fScrollButtonHeight
  1381.     );
  1382.  
  1383.     //
  1384.     //  Accept mission button
  1385.     //
  1386.  
  1387.     CreateBitmapButton(
  1388.       StartMissionButtonID,
  1389.       nAcceptButtonNormMat,
  1390.       nAcceptButtonHiMat,
  1391.       0.375,
  1392.       0.914,
  1393.       fStdButtonWidth,
  1394.       fStdButtonHeight
  1395.     );
  1396.  
  1397.     //
  1398.     //  Back button
  1399.     //
  1400.  
  1401.     CreateBitmapButton(
  1402.       "ID_BACK",
  1403.       nBackButtonNormMat,
  1404.       nBackButtonHiMat,
  1405.       0.500,
  1406.       0.914,
  1407.       fStdButtonWidth,
  1408.       fStdButtonHeight
  1409.     );
  1410.   }
  1411.  
  1412.   int m_nCreditsScreenNumber = 0;
  1413.  
  1414.   void ShowCredits()
  1415.   {
  1416.     //
  1417.     //  Background
  1418.     //
  1419.  
  1420.     CreateBitmapControl(
  1421.       "Resources/" + str_CreditsScreens[m_nCreditsScreenNumber],
  1422.       "ID_BITMAP",
  1423.       0.0,
  1424.       0.0,
  1425.       1.0,
  1426.       1.0
  1427.     );
  1428.  
  1429.     CreateMenuButtonGroup(MenuWidth, MenuSpacing);
  1430.  
  1431.     //
  1432.     //  Next button
  1433.     //
  1434.  
  1435.     CreateBitmapButton(
  1436.       "ID_CREDITS_SCREEN",
  1437.       nCreditsButtonNormMat,
  1438.       nCreditsButtonHiMat,
  1439.       0.435,
  1440.       0.914,
  1441.       fStdButtonWidth,
  1442.       fStdButtonHeight
  1443.     );
  1444.   }
  1445. };
  1446.